
package tomkitty.server;

import tomkitty.turdlet.*;
import tomkitty.util.*;
import java.util.*;

/**
 *
 * Class holding the configuration data for the server and the turdlet
 * container. Maybe it would be better to separate turdlet configuration
 * from server configuration? I don't know.
 *
 * @author alan, micha
 *
 */
public class Configuration extends Hashtable<String, Vector<String>>{
    
    public Configuration() {
    	//confHash = new Hashtable<String, String>();
    }
    
    public String get(String key) {
			Vector<String> v = super.get(key);
			if (v == null) {
				return null;
			}
			return v.get(0);
    }
    
    public Vector<String> getAll(String key) {
			return super.get(key);
    }

		public void set(String key, String val) {
			Vector<String> v;
			if ( (v = super.get(key)) != null ) {
				v.set(0, val);
			} else {
				setAll(key, val, "unknown", "no description");
			}
		}
    
    public void setAll(String key, String val, String type, String desc) {
			Vector<String> v = new Vector<String>(3);
			v.add(val);
			v.add(type);
			v.add(desc);
			super.put(key, v);
    }
}
